home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / editor / frexxed / fpl / fmc.fpl.readme < prev    next >
Text File  |  1996-07-24  |  7KB  |  168 lines

  1. #############################################################################
  2. File:        FMC.FPL
  3. Author:        Jesper Skov   (+ a bit by Daniel Stenberg)
  4. Email:        jskov@iesd.auc.dk / http://www.iesd.auc.dk/~jskov
  5. Short:        File Mode Control - switches on modes based on file's ext
  6. Version:    2.4
  7. Date:        24.07.96
  8. Local settings:
  9. Global settings:
  10. Keysequence:
  11. Type:
  12. Prereq:
  13. Copyright:    © 1995-1996, Jesper Skov
  14. #############################################################################
  15.  
  16. FUNCTION
  17.   This package give FrexxEd the powerfull ability of recognizing different
  18.   file types, and act in a (by you) predefined manner. As of FrexxEd version
  19.   1.7, FMC is included by the FrexxEd.FPL file (you should remove it from
  20.   your User.FPL file if it's therein!)
  21.  
  22.   I think I better give you some examples:
  23.  
  24.   You load a file named "test.fpl". C style indention is automatically
  25.   switched on, and perhaps some ETags are loaded.
  26.  
  27.   I create a file named "text.tex". LaTeX mode gets switched on as does
  28.   double mode (I'm Danish - we have funky letters :)
  29.  
  30.   In both examples some other things may happen without you having to
  31.   explicitly specify it. This could be the syntax of comments being changed,
  32.   or needed external ARexx servers being launched.
  33.  
  34.  
  35.   For this to work FMC introduces a new concept - the major and minor modes.
  36.  
  37.   What are modes?
  38.  
  39.   Major mode:
  40.    A major mode is a FrexxEd "environment" which will allow communication
  41.    with external applications. This could be an assembler, compiler or a
  42.    viewer.
  43.    Only one major mode is active at a time.
  44.  
  45.   Minor mode:
  46.    A minor mode is a more text oriented interface - making it easier for the
  47.    user to work with the format of the text/source used by external
  48.    applications. This could be indention control for C, assembler or Pascal.
  49.    Maybe some macro packages for LaTeX or HyperText (AmigaGuide format).
  50.    Also things like word wrap and my DoubleMode are considered minor modes.
  51.    In short, anything not an interface is a minor mode.
  52.    Many minor modes may be active at a time.
  53.  
  54.  
  55.   "OK", you ask. "What's the big deal here?"
  56.  
  57.   Methaphorically speaking, you may now not only select what's for dinner,
  58.   but also what spices to use :)
  59.  
  60.   This is possible because each major mode has the following information:
  61.  
  62.   extensions: What file types should trigger this mode?
  63.               The extensions are case in-sensitive and separated with stars:
  64.               Examples: "*c*h*" - could be for a C mode.
  65.                         "*text*txt*readme*" - could be for a text mode.
  66.  
  67.   execute: A string that will be executed when the mode is switched on. This
  68.            string (full FPL syntax) includes the code responsible for
  69.            switching on minor modes. There may also be calls to (major) mode
  70.            specific initialization - these should be default settings from
  71.            the authors side.
  72.            To make it easier for you to add more spice, you may use a
  73.            function called ME(string mode_name). It will switch on the minor
  74.            mode of name "mode_name" (beats writing SetInfo(-1,mode_name,1);).
  75.        Some minor modes also contain a function which initializes
  76.        miscellaneous settings like the comment strings. Check with the
  77.        documentation (or FPL code) of a minor mode to se how you should
  78.        start it.
  79.  
  80.   You may change these settings with "Customizing->Program->Major Modes", and
  81.   the idividual buffer's major mode and minor modes with
  82.   "Customizing->Buffer Mode->Major/Minor".
  83.  
  84.   Whenever you change a buffer's major mode, all minor modes are disabled. It
  85.   is then the job of the major mode's execute to enable the correct minor
  86.   modes.
  87.  
  88.  
  89.  
  90.   You may also force a major mode by putting the string
  91.   "-*-<mode name>-*-" in the first line of a file. For example, if you write
  92.   many install scripts and have made a LISP major mode (it is LISP code,
  93.   right? Looks like it to me, anyway!) the first line of the file
  94.   "Install_english" could be "## -*-lisp_mode-*-" (## represents a comment -
  95.   I don't know the syntax, sorry). Now the buffer would be in LISP mode, even
  96.   though the file has no extension (as opposed to "file.lisp").
  97.  
  98.  
  99.   ------
  100.  
  101.   If you want to make your own major/minor modes all you have to do is to call
  102.   the function AddMode described below:
  103.  
  104.   AddMode(int type, string name, string extensions, string execute)
  105.  
  106.   type:       0 = minor mode, 1 = major mode
  107.   name:       name of mode info variable (e.g. "latex_mode")
  108.               (boolean, "LBH")
  109.   extensions: name of extensions info variable (e.g. "latex_ext")
  110.               Only for major mode! (string, "GSWH")
  111.   execute:    name of execute info variable (e.g. "latex_exe")
  112.               Only for major mode! (string, "GSWH")
  113.  
  114.   You must create the info variables yourself. They should have the type
  115.   strings listed above. If you are making a minor mode, extensions and
  116.   execute should be empty strings (e.g. AddMode(0,"double_mode","","")).
  117.  
  118.   If you have already made something that should be a major/minor mode, and
  119.   have any questions about how to make it FMC compatible, please let me know.
  120.   Also, you may find answer to your questions in some of my (or others) modes.
  121.   Check out DoubleMode (minor mode) and PasTeXMode (major mode).
  122.  
  123.  
  124.   You may now (16.06.95) also consult the following files (please do!):
  125.  
  126.   Major modes:    FPLmode.FPL, PasTeXMode.FPL, SNMAMode.FPL & TextMode.FPL
  127.  
  128.   Minor modes:    AsmMode.FPL, CIndentMode.FPL, CMode.FPL, CommentMode.fpl,
  129.         DoubleMode.FPL, LaTeXMode.FPL & TextMode.FPL
  130.  
  131.  
  132.   Notice that TextMode is both Major and Minor mode!!! There really isn't any
  133.   interface part of editing a text (well, maybe printing) so I have made it a
  134.   major mode, which holds the functions normally found in minor modes.
  135.  
  136.  
  137. HISTORY (REV)
  138.   24.07.96 (4)    Related to the rev 3 fix; The 'face' setting was not reset.
  139.  
  140.   07.07.96 (3)    Minor modes were not properly disabled when a major mode
  141.         was enabled at load time. This could result in C Indenting
  142.         being enabled when editing assembler sources...
  143.         Very annoying :)
  144.         Also fixed a few 'extern' key word inconsistencies.
  145.  
  146.   21.10.95 (2)    The file extension is now also checked after a Rename (and
  147.         therefore also after SaveAs). Suggested by Mathias Axelsson.
  148.  
  149.   18.08.95 (1)    Changing major mode was not properly handled. Fixed.
  150.  
  151.   02.04.95 (0)    Written with experience from LMC and FMC1.1, and after
  152.                 general acceptance of my ideas on the FrexxEd mailing
  153.                 list =)
  154.  
  155. BUGS
  156.   Be sure to report any bugs you may find!
  157.  
  158. TODO
  159.   Get old FPL modes prepped to the FMC.
  160.   Make people use the mode concept in the future.
  161.   A better documentation here - describing how a mode should be programmed
  162.    (what functions should be included etc.) At the moment I urge you to check
  163.    out (all) the modes listed above, so you may figure out for yourself what
  164.    a mode should contain.
  165.  
  166. SEE ALSO
  167.   Larry Niven & Steven Barnes' "The Barsoom Project" (ISBN: 0-330-31670-2)
  168.